<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // console.dir(Array);

    Array.prototype.myslice = function(startIndex, endIndex){
        var list = [];
        for(var i = startIndex; i < endIndex; i++){
            var item = this[i];
            list.push(item);
        }
        return list;
    }

    Array.prototype.myEach = function(fn){
        for (var i = 0; i < this.length; i++){
            var item = this[i];
            var index = i;
            var array = this;
            fn(item, index, array)
        }
    }

    var arr = [1, 2, 3];
    // console.log(arr);
    console.log(arr.constructor === Array);

    console.log(arr.myslice(1, 2));

    arr.myEach(function(item, index, array){
        console.log(item, index, array);
    })
</script>
</html>